package com.bite.common.core.domain;

import cn.hutool.core.bean.BeanUtil;
import com.bite.common.core.domain.vo.LoginUserVO;
import com.bite.common.core.enums.UserIdentity;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class LoginUser {
    private int identity; // 用户身份 1表示普通用户 2表示管理员
    private String nickName; // 别名
    private String avatar; // 头像

    public LoginUser(UserIdentity userIdentity, String nickName) {
        this.identity = userIdentity.getValue();
        this.nickName = nickName;
    }

    /**
     * 变为VO对象
     */
    public LoginUserVO toVO() {
        LoginUserVO loginUserVO = new LoginUserVO();
        BeanUtil.copyProperties(this, loginUserVO);
        return loginUserVO;
    }
}
